﻿@model KL.Store.Web.Models.BannerDuzenleModel
@using KL.Store.Core
@{
    Layout = null;
    var ver = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString(); 

}
<div class="col-xs-12 first" id="BannerFields">
    @using (Ajax.BeginForm("BannerSet", "ReportPanel", null, new AjaxOptions { HttpMethod = "Post", OnBegin = "loadingMsg();" }, new { id = "banneredit", name = "banneredit", @class = "form-horizontal editform" }))
    {
        if (Model.Banner.BannerID == 0)
        {
        @Html.HiddenFor(m => m.Banner.BannerID)
        @Html.HiddenFor(m => m.Banner.ListOrder)
        @Html.HiddenFor(m => m.Banner.PublishDate)
        }
        <div class="form-group">
            <table id="BannerUpdate" class="table table-bordered">
                <thead>
                    <tr>
                        @if (Model.Banner.BannerID > 0)
                        {
                            <td style="width: 7%; vertical-align: middle; text-align: center;">#</td>
                        }
                        <td style="width: 15%;">Ad</td>
                        <td style="width: 15%;">Açıklama</td>
                        <td style="width: 5%;">Aktif</td>
                        @if (Model.Banner.BannerID > 0)
                        {
                            <td style="width: 5%;">Sıra</td>
                        }
                        <td style="width: 15%;">URL</td>
                        @if (Model.Banner.BannerID > 0)
                        {
                            <td style="width: 15%;">Yayınlanma Tarihi</td>
                        }
                        <td style="width: 15%;">Bitiş Tarihi</td>
                        <td style="width: 8%;">Pozisyon</td>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        @if (Model.Banner.BannerID > 0)
                        {
                            <td style="vertical-align: middle; text-align: center;">
                                @Html.HiddenFor(m => m.Banner.BannerID)
                                @(Model.Banner.BannerID)
                            </td>
                        }
                        <td>
                            @Html.TextBoxFor(m => m.Banner.Name)
                        </td>
                        <td>
                            @Html.TextBoxFor(m => m.Banner.Aciklama)
                        </td>
                        <td>
                            <select name="IsActive" id="IsActive">
                                <option value="1" @{ if (Model.Banner.IsActive)
                                                     { <text> selected="selected"</text>} }>Aktif</option>
                                <option value="0" @{ if (!Model.Banner.IsActive)
                                                     { <text> selected="selected"</text>} }>Pasif</option>
                            </select>
                        </td>
                        @if (Model.Banner.BannerID > 0)
                        {
                            <td>
                                @Html.TextBoxFor(m => m.Banner.ListOrder)
                            </td>
                        }
                        <td>
                            @Html.TextBoxFor(m => m.Banner.Url)
                        </td>
                        @if (Model.Banner.BannerID > 0)
                        {
                            <td>
                                @Html.TextBoxFor(m => m.Banner.PublishDate, new { @class = "datetimepicker" })
                            </td>
                        }
                        <td>
                            @Html.TextBoxFor(m => m.Banner.EndDate, new { @class = "datetimepicker" })
                        </td>
                        <td>
                            <select name="Banner.Pozisyon" id="Banner_Pozisyon">
                                <option value="" @{ if (Model.Banner.Pozisyon == "")
                                                    { <text> selected="selected"</text>} }>Standart</option>
                                <option value="M" @{ if (Model.Banner.Pozisyon == "M")
                                                     { <text> selected="selected"</text>} }>Mobil Slider</option>
                            </select>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
        <div class="form-group">
            @Html.TextAreaFor(model => model.Banner.Html, new { @class = "form-control ckeditor", @placeHolder = "Ürünün açıklamasını giriniz" })
        </div>
        <div class="form-group text-right">
            @if (Model.Banner.BannerID > 0)
            {
                <button type="button" class="btn btn-danger" onclick="bannerSil(@(Model.Banner.BannerID));">Banner'ı Sil</button>
            }
            <button type="submit" class="btn btn-success">Kaydet</button>
        </div>
    }
</div>
<div class="clearfix"></div>
@if (Model.Banner.BannerID > 0)
{
    <div class="col-xs-12 first">
        <div class="form-group">
            <h3>Resim Yükleme</h3>
        </div>
    </div>
    <div class="col-xs-6 first form-horizontal">
        <div class="form-group">
            <form id="BannerUpload" class="upload" method="post" action="/Upload/RPImageUpload" enctype="multipart/form-data">
                <div id="BannerDrop" class="drop">
                    Banner Resimini Buraya Sürükle<br />
                    <a>Gözat</a>
                    <input type="file" name="file" />
                </div>
                <ul>
                </ul>
                <input type="hidden" name="Id" value="@(Model.Banner.BannerID)"/>
                <input type="hidden" name="Password" value="@(Model.Password)" />
                <input type="hidden" name="ImageType" value="banner" />
                <input type="hidden" name="ImageNo" value="0" />
                <input type="hidden" name="FileName" value="0" />
            </form>
            <div class="clearfix"></div>
            <hr />
            <h4>Önizleme:</h4>
            <img src="@(Parameters.WebSiteImageUrl)/banner/@(Model.Banner.BannerID).jpg?v=@(ver)" style="max-width:90%;" />
        </div>
    </div>
    <div class="col-xs-6 form-horizontal">
        <div class="form-group">
            <form id="BannerThumbUpload" class="upload" method="post" action="/Upload/RPImageUpload" enctype="multipart/form-data">
                <div id="BannerThumbDrop" class="drop">
                    Banner Önileme Resmini Buraya Sürükle<br />
                    <a>Gözat</a>
                    <input type="file" name="file" />
                </div>
                <ul>
                </ul>
                <input type="hidden" name="Id" value="@(Model.Banner.BannerID)"/>
                <input type="hidden" name="Password" value="@(Model.Password)" />
                <input type="hidden" name="ImageType" value="banner-thumb" />
                <input type="hidden" name="ImageNo" value="0" />
                <input type="hidden" name="FileName" value="0" />
            </form>
            <div class="clearfix"></div>
            <hr />
            <h4>Önizleme:</h4>
            <img src="@(Parameters.WebSiteImageUrl)/banner-thumb/@(Model.Banner.BannerID).jpg?v=@(ver)" style="max-width:90%;" />
        </div>
    </div>
}